package test20160604StaticInnerClass;
/**
 * @desc	静态内部类 
 * @author kanggw
 * @datetime 2016年6月4日,下午9:38:59
 */
public class StaticInnerClass {

	//定义一个静态内部类，里面有两个属性为最大值和最小值
	public static class  Result{
		
		private double max;
		private double min;
		
		public Result() {

		}
		
		public Result(double max,double min) {

			this.max = max;
			this.min = min;
		}

		public double getMax() {
			return max;
		}

		public void setMax(double max) {
			this.max = max;
		}

		public double getMin() {
			return min;
		}

		public void setMin(double min) {
			this.min = min;
		}
		
	}
	
	//定义一个静态方法，对数组进行排序比较
	 static Result getResult(double[] arr) {
		
		double min = Double.MAX_VALUE;
		double max = Double.MIN_VALUE;
		
		for(double i : arr) {
			
			if(i < min) {
				min = i;
			}
			if(i > max) {
				max = i;
			}
			
		}
		return new Result(max,min);
	}
	
}
